Skip to content

[WIP][v6r20] Space token usage#3601

Closed
chaen wants to merge 27 commits into
DIRACGrid:integrationfrom
chaen:rel-v6r20_FEDE_spaceTokenUsage
Closed

[WIP][v6r20] Space token usage#3601
chaen wants to merge 27 commits into
DIRACGrid:integrationfrom
chaen:rel-v6r20_FEDE_spaceTokenUsage

Conversation

@chaen

@chaen chaen commented Jan 19, 2018

Copy link
Copy Markdown
Contributor

This PR is meant to replace #3572
It contains a real implementation of the getOccupancy for the StorageElement, as well as an implementation for GFAL2_SRM2.
Note that the version of gfal2 we use at the moment has bugs (see comments) that will be fixed in 2.15. For the time being, I wrote workarounds.

BEGINRELEASENOTES
*Core
NEW: utility to convert file sizes between different unit

*Resources
NEW: Added StorageElement.getOccupancy() method for DIP and GFAL2_SMR2 SE types

*RSS
CHANGE: Using StorageElement.getOccupancy()

ENDRELEASENOTES

fstagni and others added 26 commits December 7, 2017 15:51
…Usage

* origin/spaceTokenUsage: (26 commits)
  Conflicts resolved
  Resolved conflicts
  v6r19p9
  v6r19p9 notes
  testing on protocol
  using base types
  allow also space-separated arguments
  allow giving list of requests in a file
  using URLBase for everything but SRM2
  case when an SE is at no sites
  added some doc
  added protection
  just style
  use resolveSEGroup
  avoid instantiating all local SEs
  marked getStorageElementOptions as deprecated
  style
  also considering CEs, not only SEs
  style
  docs and pylints
  ...
* upstream/integration: (25 commits)
  v6r19p10, v6r20-pre10
  v6r19p10
  v6r20-pre10
  wrap lines better
  fix isinstance
  Added warning log message in case of exception
  log the delay
  only set delay once
  again logging
  fix logging
  delay execution if no active replicas found
  delay execution by 1 h if no active replicas found
  print NotBefore
  use defaultdict
  Catch exception when closing closed connection
  few more logging changes
  less logging in DM transfers
  limit logging
  fix case when no site is found for SE
  don't try and get SE metadata if replica is inactive
  ...
* upstream/integration:
  styled
  bug fix (double return)
  DMS: fix bad merge of ReplicateAndRegister
* upstream/integration:
  v6r19p11
  v6r20-pre10 notes
  v6r19p11 notes
  using python modules
  always removing the sandboxes of deleted jobs
  just style
  just style
  added doc about shifterProxy
  64 chars instead of 32
  new option --Force to reset even non-failed requests + accept job IDs from a file
  new option --Maximum to limit the number of jobs selected + autopep8
  autopep8
  reset the NotBefore field for all requests when --Reset is used
  make pylint happier with data members
  RMS: add missing JOIN in the web summary query
  style
  fixed exception handling
@chaen chaen requested review from atsareg and fstagni as code owners January 19, 2018 15:58
@coveralls

coveralls commented Jan 19, 2018

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.03%) to 20.164% when pulling c5750b7 on chaen:rel-v6r20_FEDE_spaceTokenUsage into 72ba305 on DIRACGrid:integration.

@chaen

chaen commented Jan 22, 2018

Copy link
Copy Markdown
Contributor Author

@zmathe my PR fails with
AccountingSystem/DB/test/Test_AccountingDB.py:169: [E1101(no-member), MakeQuery.test__queryType1] Instance of 'AccountingDB' has no '_AccountingDB__queryType' member
Does that ring a bell to you ?

@fstagni can you please check the changes I did ?

@zmathe

zmathe commented Jan 22, 2018

Copy link
Copy Markdown

__queryType is exists. I do not know why it is failing.

spaceTokenAttr = 'spacetoken.description?%s' % self.protocolParameters['SpaceToken']
# gfal2 can take any srm url as a base.
spaceTokenEndpoint = self.getURLBase()['Value']
print "%s %s" % (spaceTokenEndpoint, spaceTokenAttr)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in a debug log?

occupancyStr = self.ctx.getxattr(spaceTokenEndpoint, spaceTokenAttr)
try:
occupancyDict = json.loads(occupancyStr)
except ValueError:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you prepend the comment below with a FIXME?


except (gfal2.GError, ValueError) as e:
errStr = 'Something went wrong while checking for spacetoken occupancy.'
self.log.verbose(errStr, e.message)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a verbose message? Why not at least a warn?

sTokenDict['Free'] = float(output.get('unusedsize', '0')) / 1e12

sTokenDict['Total'] = float(occupancyDict.get('totalsize', '0')) / 1e6
sTokenDict['Free'] = float(occupancyDict.get('unusedsize', '0')) / 1e6

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if we use Guaranteed anywhere...? What was it for, do you know?

Comment thread Resources/Storage/StorageElement.py Outdated
"createDirectory": "createDirectory",
"putDirectory": "putDirectory",
"getDirectory": "getDirectory",
"getOccupancy": "getOccupancy"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not?


It loops over the different Storage Plugins to query it.

:returns: S_OK with dict (keys: Total, Guaranteed, Free)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the Guaranteed, it seems.


log.debug("Negociating protocols between %s and %s (protocols %s)" % (sourceSE.name, self.name, protocols))
log.debug(
"Negociating protocols between %s and %s (protocols %s)" %

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NegoTiating

@fstagni

fstagni commented Jan 22, 2018

Copy link
Copy Markdown
Contributor

There's a strange failure in travis (pylint), please just merge upstream/integration.

@fstagni

fstagni commented Jan 22, 2018

Copy link
Copy Markdown
Contributor

Actually integration fails: https://travis-ci.org/DIRACGrid/DIRAC/builds/330842302. I will have a look.

@fstagni

fstagni commented Jan 24, 2018

Copy link
Copy Markdown
Contributor

I merge integration in this branch so that Travis should succeed.

@fstagni

fstagni commented Jan 26, 2018

Copy link
Copy Markdown
Contributor

pylint in travis complains about

Resources/Storage/GFAL2_SRM2Storage.py:15: [E0401(import-error), ] Unable to import 'gfal2'

can we add it to https://github.com/DIRACGrid/DIRAC/blob/integration/requirements.txt like we added fts3?

@chaen

chaen commented Feb 5, 2018

Copy link
Copy Markdown
Contributor Author

We MAY try with https://gitlab.cern.ch/dmc/gfal2-bindings
But why it does not fail with the other files ? Because I did not modify these lines ?

@fstagni

fstagni commented Feb 5, 2018

Copy link
Copy Markdown
Contributor

In theory it should complain everywhere, but pylint isn't always spotting everything everywhere.

@chaen

chaen commented Feb 6, 2018

Copy link
Copy Markdown
Contributor Author

We could do it, but it requires quite some compilation work, so I think we just ignore it with a pylint flag. I will do it now, and rebase

@chaen chaen mentioned this pull request Feb 6, 2018
@chaen chaen closed this Feb 6, 2018
@chaen chaen deleted the rel-v6r20_FEDE_spaceTokenUsage branch August 14, 2019 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants